package com.sise.wangzhan.command;

import com.netflix.hystrix.HystrixCommand;
import com.netflix.hystrix.HystrixCommandGroupKey;

/**
 * @Classname CommandHelloWorld
 * @Description TODO
 * @Date 2020/4/22 21:35
 * @Created by wangzhan
 */
public class CommandHelloWorld extends HystrixCommand<String> {
    private final String name;

    public CommandHelloWorld(String name) {
        //指定命令组名
        super(HystrixCommandGroupKey.Factory.asKey("ExampleGroup"));
        this.name = name;
    }

    @Override
    protected String run() throws Exception {
        //以来逻辑封装在run()方法中
        return "Hello "+ name + "! thread:"+Thread.currentThread().getName();
    }
}
